#pragma once
#include "Scene.h"
#include "Object2D.h"
#include "Image.h"
#include "ScreenText.h"
#include "SceneManager.h"
#include "RealTimeController.h"
#include <iostream>
#include "global_var.h"

using namespace std;

using namespace Pulpy;

#define TimeCount 3.0f
#define Delay 0.5f			// After pressing button, delay time before going into another scene


class MainMenu : public Scene
{
private:
	// Splash page
	bool IsSplash;
	float SplashWord;		// To control the alpha of words displaying on splash page
	float SplashTime;
	float DelayTime;			// After pressing button, delay time before going into another scene

	// Main Menu page
	Object2D Background;
	Object2D Button_1P;
	Object2D Button_2P;
	Object2D Button_Option;
	Object2D Button_HighScore;
	Object2D Button_Quit;

	// Controlling button animation
	// 0 = button not selected
	// 1 = button selected
	// 2 = button pressed
	int Button1P_Index;
	int Button2P_Index;
	int ButtonOption_Index;
	int ButtonHighScore_Index;
	int ButtonQuit_Index;

	// For making a MouseCursor object
	Object2D MouseCursor;
	
	// Textures
	TextureImage TextureMenu;
	TextureImage Texture1P[3];
	TextureImage Texture2P[3];
	TextureImage TextureOption[3];
	TextureImage TextureHighScore[3];
	TextureImage TextureQuit[3];

public:
	
	MainMenu();
	void draw();
	void update();
	void reset();
	void freeResource();
	void loadResource();
	void handleKeyboard(int key, int x, int y);
	void handleKeyboardUp(int key, int x, int y);
	void handleKeyboardSpecial(int key, int x, int y);
	void getMid(int &x, int &y);
	void handleMouseClick(int button, int state, int x, int y);
	void handleMouseMove(int x, int y);
};